Repository navigation
Take over a volume in one Mount attempt and tear down after a preempt - #13
Merged
Merged
Conversation
A start-first update that moves a volume to another node failed: each Mount gave up after 30 s with "still attached", which fails the task, and swarm paused or rolled back the update before the 90 s grace was up. A Mount now waits for the other host until 15 s short of its own deadline, so the default grace is waited out, the holder preempted and the volume attached in one attempt. A longer grace still fails and retries as before. On the node that lost the volume the teardown never ran. The in-use check stat'ed the mountpoint, which fails with EIO on the filesystem the preempt shut down, and the linger retried every 15 s forever, leaving the mount and an empty multipath map. The device number now comes from mountinfo. On dockerprime both held: the move took over at 90 s in a single attempt, the update completed, every acked write was present, and the old node tore down 17 s after the preempt.
There was a problem hiding this comment.
🟡 Changes recommended
Polling sleeps and array queries can overrun the cutoff and consume the 15-second attachment reserve, leaving insufficient time to complete takeover in one attempt.
1 open issue
What changed in this PR
This PR improves volume takeover and post-preemption cleanup in the Docker FlashArray volume plugin, aiming to complete the default grace period within one Mount attempt.
Changes:
- Extends ownership polling toward the Mount deadline while reserving time for attachment.
- Uses mountinfo instead of filesystem
statto identify devices after preemption. - Adds regression tests and updates timeout and takeover documentation.
| File | Description |
|---|---|
| README.md | Documents longer waits and start-first update behavior. |
| internal/mounter/mounter.go | Gets device identity from mountinfo to avoid post-preemption stat failures. |
| internal/mounter/mounter_test.go | Tests mountinfo-based container-use checks and absent mounts. |
| internal/driver/driver.go | Uses the full Mount budget and introduces an attachment reserve. |
| internal/driver/driver_test.go | Tests single-attempt grace waiting and the polling cutoff. |
| internal/config/config.go | Removes the outdated 30-second wait reference from a comment. |
Review effort: Balanced
Comment on lines
1351
to
1354
| if dl, ok := ctx.Deadline(); ok { | ||
| wait = min(wait, time.Until(dl)-attachReserve) | ||
| } | ||
| deadline := time.Now().Add(wait) |
The cutoff only decided whether another poll started; the sleep and the array query still ran on the Mount's deadline, so a slow answer near the cutoff could use up the time kept to attach. They now run on a deadline at the cutoff. A poll cut off mid-query fails the attempt instead of releasing or preempting on an answer it never got, and a cancelled Mount returns at once.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes two problems a start-first cross-node update hit on dockerprime under 1.4.2. Mount gave up after 30 s per attempt, so the task failed and swarm paused or rolled back the update before the 90 s grace ran out; it now waits until 15 s short of its own 110 s deadline, so the default grace is waited out and the takeover done in one attempt. The losing node's teardown looped forever because InUseByContainer stat'ed a mountpoint whose filesystem the preempt had shut down (EIO); the device now comes from mountinfo.
Tested as 1.4.3-dev on docker02/03: takeover at 90 s in one attempt, update completed, all 467 acked writes present, docker02 tore down 17 s after the preempt with no stale maps. Swarm still briefly starts a replacement for the old task when it dies on EIO (about 12 s of two copies on the new node, same mount); that's swarm's restart logic, not addressed here. Local CI gate (gofmt, vet, race tests, govulncheck, golangci-lint v2.15.0) is green.